﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace WebTools
{
    public partial class Encript : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        ///  Des加密 字符串
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEncode_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txbInput.Text))
            {
                txbResult.Text = EncriptHelper.Encode(txbInput.Text);
            }
        }

        /// <summary>
        /// 清空 加密字符串
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEncodeClear_Click(object sender, EventArgs e)
        {
            txbResult.Text = "";
            txbInput.Text = "";
        }

        /// <summary>
        ///  Des解密 字符串
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDecode_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txbInput.Text))
            {
                txbResult.Text = EncriptHelper.Decode(txbInput.Text);
            }
        }

        protected void btnSHA_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txbInput.Text))
            {
                txbResult.Text = EncriptHelper.EncryptSHA(txbInput.Text);
            }

        }

        protected void btnMD5_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txbInput.Text))
            {
                txbResult.Text = EncriptHelper.EncryptMD5(txbInput.Text);
            }

        }

        protected void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txbInput.Text))
            {
                txbResult.Text = EncriptHelper.EncryptSHA64(txbInput.Text);
            }

        }

    }
}